package com.itheima.health.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.health.pojo.OrderSetting;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@SuppressWarnings("ALL")
/**
 * @Description :
 * @author     :LD
 */
public interface OrderSettingMapper extends BaseMapper<OrderSetting> {
    @Update("update t_ordersetting set number = #{number} where orderdate=#{orderdate}")
    Boolean updateNumberByOrderdate(@Param("number") int number, @Param("orderdate") String orderdate);

    @Select("select count(1) from t_ordersetting where number>reservations and orderdate=#{orderDate}")
    int isOrderOk(String orderDate);

    @Update("update t_ordersetting set reservations=reservations+1 where orderdate=#{orderDate}")
    void updateReservationsByOrderDate(String orderDate);
}
